<?php

/**
 * @author toai9
 * @copyright 2011
 */

if(isset($_GET['mode'])&& $_GET['mode']=='detail'){
    $madanhmuc=$_GET['madanhmuc'];
    $masanpham=$_GET['masanpham'];
    //process link
   
    $sqldm='SELECT ten_danh_muc FROM tbl_danh_muc_san_pham WHERE id='.$madanhmuc.' ';
    $kqdm=tep_db_query($sqldm);
    $itemdm=tep_db_fetch_array($kqdm);
    
    
    $sqlsp='SELECT ten_san_pham FROM tbl_san_pham WHERE id='.$masanpham.' ';
    $kqsp=tep_db_query($sqlsp);
    $itemsp=tep_db_fetch_array($kqsp);
    
     # menu danh muc san pham
    $sql='select * from tbl_danh_muc_san_pham';
    $kq=tep_db_query($sql);
   
    $content.='<div class="link"><a href="index.php?page=sanpham">Sản phẩm</a> >> <a href="index.php?page=sanpham&madanhmucsanpham='.$madanhmuc.'">'.$itemdm['ten_danh_muc'].'</a> >><a href="#"> '.$itemsp['ten_san_pham'].'</a></div>
    <div id="menu_left_chung">
        <div id="menu_left">
                <ul>
                  ';
        while($item=tep_db_fetch_array($kq)){
            $content.='
                  <li><a href="?page=sanpham&amp;madanhmucsanpham='.$item['id'].'">'.$item['ten_danh_muc'].'</a><span class="closed"></span>
                    <div style="display: none;">
                      <ul>';
                        $sql1='select * from tbl_san_pham where ma_danh_muc='.$item['id'];
                        $kq1=tep_db_query($sql1);
                        while($item1=tep_db_fetch_array($kq1)){
                           $content.='<li><span class="closed"></span><a class="parent" href="index.php?page=chitietsanpham&amp;masanpham='.$item1["id"].'&amp;madanhmuc='.$item1["ma_danh_muc"].'&amp;mode=detail">'.$item1['ten_san_pham'].'</a> </li>';
                           
                        }
                           
                        
                      $content.='</ul>
        
                    </div>
                  </li>';
                  }
                  $content.='
                  
        </ul>
    </div>
<div class="menu_left_rieng">
    <a id="lienhe" rel="lienhe" href="lienhe.php" ><img src="images/contact_card.jpg" width="216"  alt="Arrow Prev" /></a>
    <a href="#" class="next"><img src="images/hotline_number.gif" width="216"  alt="Arrow Next" /></a></div>
    </div>
    ';
    #end menu danh muc san pham
     
    
    $sql='select * from tbl_san_pham where id='.$masanpham;
    $kq=tep_db_query($sql);
    $item=tep_db_fetch_array($kq);
                $content.='
                
                <div id="main_content">                            
                    <div class="show_sanpham" >                        
                       <h1>'.$item['ten_san_pham'].'</h1>                        
                        <img src="images/'.$item['hinh_anh'].'" alt="'.$item['hinh_anh'].'"/>                     
                    </div>
                    <div class="tabs">
                      <!-- tabs -->
                      <ul class="tabNavigation">
                        <li><a href="#message">Hàm Lượng</a></li>
                        <li><a href="#shareFile">Công Dụng</a></li>
                        <li><a href="#arrange">Hướng dẫn Sử Dụng</a></li>
                      </ul>
                    
                      <!-- tab containers -->
                      <div id="message">
                        <p>'.$item['ham_luong'].'</p>
                      </div>
                      <div id="shareFile">
                        <p>'.$item['cong_dung'].'</p>
                      </div>
                      <div id="arrange">
                        <p>'.$item['huong_dan_su_dung'].'</p>
                      </div>
                    </div>
                </div>';
}
echo $content;
?>